
 function bgRandom () {
 var x = '';
 var check_state =  localStorage["smart_location"];
 if(check_state == "on" || check_state == undefined)
 { 
       $('.lcs_check').prop('checked', true);
      $('.search-div').show();
	  $('.setting-btn').removeClass('settings');
 
 }else if(check_state == "off")
 {
 $('.lcs_check').prop('checked', false);
 $('.search-div').hide();
 $('.setting-btn').addClass('settings');
 
 }
jQuery('.search-div').submit(function(e)
{  
var serch = $('.search-bar').val()
 e.preventDefault();
 if(serch != "")
 window.location.replace(encodeURI("https://www.baidu.com/s?ie=UTF-8&wd="+serch))
	
});

  if(localStorage["tab"]=="" || localStorage["tab"]== undefined) {
    localStorage["tab"]=1;
	}   else if(localStorage["tab"]!="" && localStorage["tab"]!=undefined ) {

		localStorage["tab"] = ++localStorage["tab"];
	} 
		localStorage["tab"] = localStorage["tab"]%33;
 if(localStorage["tab"]==0)
		localStorage["tab"] = 1;  
	     x = localStorage["tab"]; 
 if(localStorage["tab"]==33)
	{
	localStorage["tab"]==1;
	}else if(isNaN(x)) 
    {
	localStorage["tab"]=1;
	}	
	
    if (x==1)
        { 
            $('body').css('background-image', 'url("images/catpurr.gif")');
			$('body').css('background-color','#FF7C61');
			$('.search-bar').css({"background-color":"rgba(255, 255, 255, 0.66)"});
			$('.search-btn').css("color","rgba(255, 124, 97, 0.45)");
			$('.setting-icon').css("color","rgba(255, 255, 255, 0.66)");
			$("input.search-bar").focus( function() {
				$(".search-bar").css("border","3px solid #646a71");
			});
			removefocus();
        }
        else if(x==2)
        {
            $('body').css('background-image', 'url("images/the-end.gif")');
			$('body').css('background-color','#DADADA');
			$('.search-bar').css({"background-color":"rgba(255, 255, 255, 0.54)"});
			$('.search-btn').css("color","#cecece");
			$('.setting-icon').css("color","rgba(51, 102, 135, 0.63)");
			$("input.search-bar").focus( function() {
				$(".search-bar").css("border","3px solid rgba(51, 102, 135, 0.63) ");
			});
			removefocus();
        }
		else if(x==3)
        {
            $('body').css('background-image', 'url("images/paper.gif")');
			$('body').css('background-color','rgba(146, 202, 146, 0.98)');
			$('.search-bar').css({"background-color":"rgba(245, 245, 245, 0.54)"});
			$('.search-btn').css("color","rgba(148, 203, 148, 0.59)");
			$('.setting-icon').css("color","rgba(245, 245, 245, 0.54)");
			$("input.search-bar").focus( function() {
				$(".search-bar").css("border","3px solid #609060");
			});
			removefocus();
        }
		else if(x==4)
        {
            $('body').css('background-image', 'url("images/walkingcat.gif")');
			$('body').css('background-color','#58A5A3');
			$('.search-bar').css({"background-color":"rgba(248, 218, 182, 0.76)"});
			$('.search-btn').css("color","rgba(88, 165, 163, 0.35)");
			$('.setting-icon').css("color","rgba(248, 218, 182, 0.76)");
			$("input.search-bar").focus( function() {
				$(".search-bar").css("border","3px solid #0f7977");
			});
			removefocus();
        }
		else if(x==5)
        {
            $('body').css('background-image', 'url("images/knead_dribble.gif")');
			$('body').css('background-color','#FFF2EA');
			$('.search-bar').css({"background-color":"rgba(169, 182, 196, 0.45)"});
			$('.search-btn').css("color","rgba(255, 242, 234, 0.75)");
			$('.setting-icon').css("color","#8a97a5");
			$("input.search-bar").focus( function() {
				$(".search-bar").css("border","3px solid #8a97a5");
			});
			removefocus();
        }
		else if(x==6)
        {
            $('body').css('background-image', 'url("images/bb_cat_dribbble.gif")');
			$('body').css('background-color','#FFFFFF');
			$('.search-bar').css({"background-color":"rgba(138, 137, 137, 0.24)"});
			$('.search-btn').css("color","rgba(90, 89, 88, 0.27)");
			$('.setting-icon').css("color","rgba(136, 136, 136, 0.8)");
			$("input.search-bar").focus( function() {
				$(".search-bar").css("border","3px solid rgba(156, 150, 141, 0.75) ");
			});
			removefocus();
        }
		else if(x==7)
        {
            $('body').css('background-image', 'url("images/calmingcatsmall.gif")');
			$('body').css('background-color','#66CEFF');
			$('.search-bar').css({"background-color":"rgba(255, 255, 255, 0.66)"});
			$('.search-btn').css("color","rgba(102, 206, 255, 0.42)");
			$('.setting-icon').css("color","rgba(255, 255, 255, 0.66)");
			$("input.search-bar").focus( function() {
				$(".search-bar").css("border","3px solid #53b3e0 ");
			});
			removefocus();
        }
		else if(x==8)
        {
            $('body').css('background-image', 'url("images/upside_cat.gif")');
			$('body').css('background-color','#E19A2E');
			$('.search-bar').css({"background-color":"rgba(255, 255, 255, 0.46)"});
			$('.search-btn').css("color","#e19a2e");
			$('.setting-icon').css("color","rgba(255, 255, 255, 0.46)");
			$("input.search-bar").focus( function() {
				$(".search-bar").css("border","3px solid #b5771a");
			});
			removefocus();
        }
		else if(x==9)
        {
            $('body').css('background-image', 'url("images/popcorn_dribbble.gif")');
			$('body').css('background-color','#FEDEB8');
			$('.search-bar').css({"background-color":"rgba(255, 255, 255, 0.63)"});
			$('.search-btn').css("color","#fedeb8");
			$('.setting-icon').css("color","#fff");
			$("input.search-bar").focus( function() {
				$(".search-bar").css("border","3px solid rgba(245, 134, 52, 0.39)");
			});
			removefocus();
        }
		else if(x==10)
        {
            $('body').css('background-image', 'url("images/catmouse.gif")');
			$('body').css('background-color','#327191');
			$('.search-bar').css({"background-color":"rgba(241, 239, 237, 0.63)"});
			$('.search-btn').css("color","rgba(50, 113, 145, 0.37)");
			$('.setting-icon').css("color","rgba(241, 239, 237, 0.63)");
			$("input.search-bar").focus( function() {
				$(".search-bar").css("border","3px solid #214e65");
			});
			removefocus();
        }
		else if(x==11)
        {
            $('body').css('background-image', 'url("images/01-black-cat.gif")');
			$('body').css('background-color','#161616');
			$('.search-bar').css({"background-color":"rgba(255, 255, 255, 0.88)"});
			$('.search-btn').css("color","rgba(22, 22, 22, 0.33)");
			$('.setting-icon').css("color","rgba(255, 255, 255, 0.88)");
			$("input.search-bar").focus( function() {
				$(".search-bar").css("border","3px solid #646a71");
			});
			removefocus();
        }
		else if(x==12)
        {
            $('body').css('background-image', 'url("images/grumpy_dribbble.gif")');
			$('body').css('background-color','#FFF6D9');
			$('.search-bar').css({"background-color":"rgba(255, 255, 255, 0.76)"});
			$('.search-btn').css("color","rgb(251, 241, 209)");
			$('.setting-icon').css("color","rgba(76, 93, 110, 0.71)");
			$("input.search-bar").focus( function() {
				$(".search-bar").css("border","3px solid #8e8e8e ");
			});
			removefocus();
        }
		else if(x==13)
        {
            $('body').css('background-image', 'url("images/zero.gif")');
			$('body').css('background-color','#FFFFFF');
			$('.search-bar').css({"background-color":"rgb(216, 222, 226)"});
			$('.search-btn').css("color","rgba(109, 104, 103, 0.34)");
			$('.setting-icon').css("color","#b3b1b1");
			$("input.search-bar").focus( function() {
				$(".search-bar").css("border","3px solid #b3b1b1");
			});
			removefocus();
        }
		else if(x==14)
        {
            $('body').css('background-image', 'url("images/delivery.gif")');
			$('body').css('background-color','#F5F0C5');
			$('.search-bar').css({"background-color":"rgba(255, 255, 255, 0.54)"});
			$('.search-btn').css("color","rgba(245, 240, 197, 0.83)");
			$('.setting-icon').css("color","rgba(154, 83, 15, 0.65))");
			$("input.search-bar").focus( function() {
				$(".search-bar").css("border","3px solid #d2cda8");
			});
			removefocus();
        }
		else if(x==15)
                {
            $('body').css('background-image', 'url("images/charm_-_the_black_cat_2.gif")');
			$('body').css('background-color','#000');
			$('.search-bar').css({"background-color":"rgba(255, 255, 255, 0.86)"});
			$('.search-btn').css("color","rgba(132, 132, 132, 0.5)");
			$('.setting-icon').css("color","rgba(255, 255, 255, 0.439216)");
			$("input.search-bar").focus( function() {
				$(".search-bar").css("border","3px solid rgb(99, 91, 91)");
			});
			removefocus();
        }
		else if(x==16)
        {
            $('body').css('background-image', 'url("images/kittens_dribbble.gif")');
			$('body').css('background-color','#3C4843');
			$('.search-bar').css({"background-color":"rgba(219, 212, 197, 0.76)"});
			$('.search-btn').css("color","rgba(60, 72, 67, 0.44)");
			$('.setting-icon').css("color","rgba(219, 212, 197, 0.76)");
			$("input.search-bar").focus( function() {
				$(".search-bar").css("border","3px solid #696053");
			});
			removefocus();
        }
		else if(x==17)
        {
            $('body').css('background-image', 'url("images/01-kitty_v2.gif")');
			$('body').css('background-color','#976D9E');
			$('.search-bar').css({"background-color":"rgba(255, 255, 255, 0.62)"});
			$('.search-btn').css("color","rgba(151, 109, 158, 0.43)");
			$('.setting-icon').css("color","rgba(255, 255, 255, 0.62)");
			$("input.search-bar").focus( function() {
				$(".search-bar").css("border","3px solid #734b79 ");
			});
			removefocus();
        }
		else if(x==18)
        {
            $('body').css('background-image', 'url("images/mycatfit_dribbble.gif")');
			$('body').css('background-color','#FFFFFF');
			$('.search-bar').css({"background-color":"rgba(138, 137, 137, 0.24)"});
			$('.search-btn').css("color","rgba(55, 91, 131, 0.24)");
			$('.setting-icon').css("color","#9c9b98");
			$("input.search-bar").focus( function() {
				$(".search-bar").css("border","3px solid #9c9b98");
			});
			removefocus();
        }
		else if(x==19)
        {
            $('body').css('background-image', 'url("images/cat-lunch.gif")');
			$('body').css('background-color','#83C2D6');
			$('.search-bar').css({"background-color":"rgba(197, 231, 239, 0.67)"});
			$('.search-btn').css("color","#83c2d6");
			$('.setting-icon').css("color","rgba(197, 231, 239, 0.67)");
			$("input.search-bar").focus( function() {
				$(".search-bar").css("border","3px solid #5c9cb1");
			});
			removefocus();
        }
		else if(x==20)
        {
            $('body').css('background-image', 'url("images/fat_dribbble_o.gif")');
			$('body').css('background-color','#98B0DD');
			$('.search-bar').css({"background-color":"rgba(241, 239, 238, 0.35)"});
			$('.search-btn').css("color","rgba(152, 176, 221, 0.65)");
			$('.setting-icon').css("color","#576a8e");
			$("input.search-bar").focus( function() {
				$(".search-bar").css("border","3px solid #576a8e");
			});
			removefocus();
        }
		else if(x==21)
        {
            $('body').css('background-image', 'url("images/facepalm_dribbble1.gif")');
			$('body').css('background-color','#107458');
			$('.search-bar').css({"background-color":"rgba(236, 192, 114, 0.48)","color":"#fff"});
			$('.search-btn').css("color","#107458");
			$('.setting-icon').css("color","rgba(236, 192, 114, 0.48)");
			$("input.search-bar").focus( function() {
				$(".search-bar").css("border","3px solid #218c6e");
			});
			removefocus();
        }
		else if(x==22)
        {
            $('body').css('background-image', 'url("images/catscared_dribbble.gif")');
			$('body').css('background-color','#FFC94B');
			$('.search-bar').css({"background-color":"rgba(255, 255, 255, 0.76)"});
			$('.search-btn').css("color","rgba(255, 201, 75, 0.46)");
			$('.setting-icon').css("color","rgba(255, 255, 255, 0.76)");
			$("input.search-bar").focus( function() {
				$(".search-bar").css("border","3px solid #a08035");
			});
			removefocus();
        }
		else if(x==23)
        {
            $('body').css('background-image', 'url("images/cat-wistle.gif")');
			$('body').css('background-color','#fffbfb');
			$('.search-bar').css({"background-color":"rgba(138, 137, 137, 0.24)"});
			$('.search-btn').css("color","rgba(76, 76, 76, 0.31)");
			$('.setting-icon').css("color","#b3b1b1");
			$("input.search-bar").focus( function() {
				$(".search-bar").css("border","3px solid #b3b1b1");
			});
			removefocus();
        }
		else if(x==24)
        {
            $('body').css('background-image', 'url("images/catanimate_v2.gif")');
			$('body').css('background-color','#F96C35');
			$('.search-bar').css({"background-color":"rgba(255, 255, 255, 0.68)"});
			$('.search-btn').css("color","rgba(249, 108, 53, 0.33)");
			$('.setting-icon').css("color","rgba(255, 255, 255, 0.68)");
			$("input.search-bar").focus( function() {
				$(".search-bar").css("border","3px solid #bd4d21");
			});
			removefocus();
        }
		else if(x==25)
        {
            $('body').css('background-image', 'url("images/cat_toiletpaper_160211drib.gif")');
			$('body').css('background-color','#F7F7F8');
			$('.search-bar').css({"background-color":"rgba(218, 218, 218, 0.75)"});
			$('.search-btn').css("color","rgba(240, 166, 40, 0.27)");
			$('.setting-icon').css("color","#b3b1b1");
			$("input.search-bar").focus( function() {
				$(".search-bar").css("border","3px solid #b3b1b1");
			});
			removefocus();
        }
		else if(x==26)
        {
            $('body').css('background-image', 'url("images/kitty-wiggle-full.gif")');
			$('body').css('background-color','#FFFFFF');
			$('.search-bar').css({"background-color":"rgba(208, 209, 210, 0.54)"});
			$('.search-btn').css("color","rgba(115, 105, 105, 0.2)");
			$('.setting-icon').css("color","#9c9b98");
			$("input.search-bar").focus( function() {
				$(".search-bar").css("border","3px solid #9c9b98");
			});
			removefocus();
        }
		else if(x==27)
        {
            $('body').css('background-image', 'url("images/catplay_dribbble.gif")');
			$('body').css('background-color','#2297D4');
			$('.search-bar').css({"background-color":"rgba(255, 255, 255, 0.48)"});
			$('.search-btn').css("color","rgba(92, 25, 254, 0.17)");
			$('.setting-icon').css("color","rgba(255, 255, 255, 0.48)");
			$("input.search-bar").focus( function() {
				$(".search-bar").css("border","3px solid #1979ab");
			});
			removefocus();
        }
		else if(x==28)
        {
            $('body').css('background-image', 'url("images/whos-there-cat.gif")');
			$('body').css('background-color','#FFFFFF');
			$('.search-bar').css({"background-color":"rgba(214, 211, 211, 0.490196)"});
			$('.search-btn').css("color","rgba(115, 105, 105, 0.2)");
			$('.setting-icon').css("color","rgba(101, 99, 99, 0.44)");
			$("input.search-bar").focus( function() {
				$(".search-bar").css("border","3px solid rgba(158, 231, 199, 0.58)");
			});
			removefocus();
        }
			else if(x==29)
        {
            $('body').css('background-image', 'url("images/untitled-1.gif")');
			$('body').css('background-color','#FFFFFF');
			$('.search-bar').css({"background-color":"rgba(230, 230, 230, 0.682353)"});
			$('.search-btn').css("color","rgba(230, 202, 180, 0.89)");
			$('.setting-icon').css("color","rgba(101, 99, 99, 0.44)");
			$("input.search-bar").focus( function() {
				$(".search-bar").css("border","3px solid rgb(230, 202, 180)");
			});
			removefocus();
        }
		else if(x==30)
        {
            $('body').css('background-image', 'url("images/cat_slow_mo.gif")');
			$('body').css('background-color','#FFFFFF');
			$('.search-bar').css({"background-color":"rgba(236, 235, 235, 0.68)"});
			$('.search-btn').css("color","rgba(255, 204, 153, 0.55)");
			$('.setting-icon').css("color","rgba(101, 99, 99, 0.44)");
			$("input.search-bar").focus( function() {
				$(".search-bar").css("border","3px solid rgba(255, 204, 153, 0.82)");
			});
			removefocus();
        }
		else if(x==31)
        {
            $('body').css('background-image', 'url("images/cube_cat_800.gif")');
			$('body').css('background-color','rgb(0, 144, 184)');
			$('.search-bar').css({"background-color":"rgba(214, 211, 211, 0.490196)"});
			$('.search-btn').css("color","rgba(0, 144, 184, 0.59)");
			$('.setting-icon').css("color","rgb(9, 82, 103)");
			$("input.search-bar").focus( function() {
				$(".search-bar").css("border","3px solid  rgb(13, 103, 128)");
			});
			removefocus();
        }
		else if(x==32)
        {
            $('body').css('background-image', 'url("images/meal.gif")');
			$('body').css('background-color','rgb(254, 249, 232)');
			$('.search-bar').css({"background-color":"rgba(214, 211, 211, 0.3)"});
			$('.search-btn').css("color","rgba(196, 139, 92, 0.37)");
			$('.setting-icon').css("color","rgba(166, 82, 20, 0.67)");
			$("input.search-bar").focus( function() {
				$(".search-bar").css("border","3px solid rgba(185, 96, 30, 0.47)");
			});
			removefocus();
        }
}

 function removefocus(){
 
      $(".search-bar").focusout( function() {
				$(".search-bar").css("border","3px solid transparent");
			});
  };
$( document ).ready(function() {
        bgRandom();
		removefocus();
		$('#pgh-show').hide();
});
 //flip button settings
 $(document).ready(function(e)
 {
         $('.lcs_check').lc_switch();
// triggered each time a field is checked

$('body').delegate('.lcs_check', 'lcs-on', function() {
	   localStorage["smart_location"] = "on";
	  $('.search-div').show();
	  $('#pgh-hide').show();
	  $('#pgh-show').hide();
	  $('.setting-btn').removeClass('settings');
});

// triggered each time a field is unchecked
$('body').delegate('.lcs_check', 'lcs-off', function() {

	   localStorage["smart_location"] = "off";
     $('.search-div').hide();
	 $('#pgh-hide').hide();
	 $('#pgh-show').show();
	 $('.setting-btn').addClass('settings');
});

 });
 